#ifndef __KEY_H__
#define __KEY_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "rf200_usart.h"

#define KEY_PRESSED 						GPIO_PIN_RESET
#define KEY_0_STATE 						HAL_GPIO_ReadPin(KEY_0_GPIO_Port, KEY_0_Pin)
#define KEY_UP_STATE						HAL_GPIO_ReadPin(GPIOA, KEY_UP_Pin)
#define KEY_DOWN_STATE					HAL_GPIO_ReadPin(GPIOA, KEY_DOWN_Pin)
#define KEY_LEFT_STATE					HAL_GPIO_ReadPin(GPIOA, KEY_LEFT_Pin)
#define KEY_RIGHT_STATE					HAL_GPIO_ReadPin(GPIOB, KEY_RIGHT_Pin)
#define KEY_X_STATE							HAL_GPIO_ReadPin(GPIOB, KEY_X_Pin)
#define KEY_Y_STATE							HAL_GPIO_ReadPin(GPIOB, KEY_Y_Pin)
#define KEY_A_STATE							HAL_GPIO_ReadPin(GPIOB, KEY_A_Pin)
#define KEY_B_STATE							HAL_GPIO_ReadPin(GPIOB, KEY_B_Pin)
#define KEY_LEFTROCKER_STATE 		HAL_GPIO_ReadPin(KEY_LeftRocker_GPIO_Port, KEY_LeftRocker_Pin)
#define KEY_RIGHTROCKER_STATE 	HAL_GPIO_ReadPin(KEY_RightRocker_GPIO_Port, KEY_RightRocker_Pin)

#define TRUE 1
#define FALSE 0

typedef struct 
{
	_Bool key0, key_left_rocker, key_right_rocker;
	_Bool up, down, left, right;
	_Bool X, Y, A, B;
	uint16_t * rocker;
}telecontrol_struct_type;

extern telecontrol_struct_type telecontrol;

#ifdef __cplusplus
}
#endif
#endif /*__ KEY_H__ */